import request from "@/utils/http";

// 获取重定向地址
export function getHref(data) {
    return request({
        url: '/mp/wxuser/getAuthorize',
        method: 'post',
        data: data
    })
}


// 获取微信公众号信息
export function getWxQr(data) {
    return request({
        url: '/mp/wxuser/getWxQr',
        method: 'get',
        params: data
    })
}

// 获取店员微信公众号信息
export function getClerkQrCode(data) {
    return request({
        url: '/mp/wxuser/userQrCode',
        method: 'get',
        params: data
    })
}

// 获取用户与公众号信息
export function getWxUser(data) {
    return request({
        url: '/mp/wxuser/getWxUser',
        method: 'get',
        params: data
    })
}

// 用户绑定微信
export function bindWxUser(data) {
    return request({
        url: '/admin/social/bindManySocialByOpenId',
        method: 'post',
        params: data
    })
}

// 获取登录验证码
export function rlsmsCode(mobile) {
    return request({
        url: '/admin/mobile/registerOrLogin/' + mobile,
        method: 'get'
    })
}

// 注册即登录
export function registerOrLogin(data) {
    return request({
        url: '/admin/register/registerOrLogin',
        method: 'post',
        data: data,
    })
}

// 获取角色权限
export function roleList(data) {
    return request({
        url: '/admin/role/getRoleList',
        method: 'post',
        data: data
    })
}
// 查询ssn的绑定状态
export function userSnStatus(sn) {
    return request({
        url: '/admin/yaseeuserdevice/userStatus/' + sn,
        method: 'get'
    })
}

// 绑定设备
export function bindDevice(data) {
    return request({
        url: '/admin/yaseeuserdevice/binds',
        method: 'post',
        data: data
    })
}

// 微信登录
export function openIdLogin(code) {
    return request({
        url: '/auth/oauth/token?grant_type=mobile&mobile=WX@' + code.code + '&code=' + code.code,
        method: 'post',
        headers: {
            'Authorization': 'Basic c29jaWFsOjRjMmRmMTc4OWRmNDQwOWU5YTBiOTAxODA5MjlhMzg1',
            'TENANT-ID': '1'
        }
    })
}

// 获取患者信息
export function resInfo() {
    return request({
        url: '/bio/resident/homePage',
        method: 'get',
    })
}


// 获取历史数据类型
export function typeList(type) {
    return request({
        url: '/bio/testData/getName/' + type,
        method: 'get',
    })
}

// 获取历史数据
export function testDataList(type, resId, data) {
    return request({
        url: '/bio/testData/list/' + type + '/' + resId,
        method: 'get',
        params: data
    })
}
// 获取血压历史
export function pressureList(id, data) {
    return request({
        url: '/bio/bloodPressure/pageCustomizationByResId/' + id,
        method: 'get',
        params: data

    })
}

// 获取血糖历史
// export function sugarList(id, data) {
//     return request({
//         url: '/bio/bloodGlucose/pageCustomizeByResId/' + id,
//         method: 'get',
//         params: data
//     })
// }

// 获取尿酸历史
// export function acidList(id, data) {
//     return request({
//         url: '/bio/uricAcid/' + id,
//         method: 'get',
//         params: data
//     })
// }

// 获取血酮历史
// export function ketoneList(id, data) {
//     return request({
//         url: '/bio/bloodKetone/' + id,
//         method: 'get',
//         params: data
//     })
// }

// 获取血糖时段
export function sugarPeriod() {
    return request({
        url: '/bio/bloodglucoseperiod/list',
        method: 'get',
    })
}


// 获取血压管理级别规则
export function bloodPressureLevelList() {
    return request({
        url: '/bio/bloodPressureLevel/list',
        method: 'get',
    })
}

// 获取用户信息
export function userInfo() {
    return request({
        url: '/admin/user/info',
        method: 'get',
    })
}

// 修改用户信息
export function updateUser(data) {
    return request({
        url: '/admin/user/appEdit',
        method: 'put',
        data
    })
}

// 查询本人绑定的设备信息
export function deviceList(data) {
    return request({
        url: '/admin/yaseeuserdevice/getUserDevice',
        method: 'get',
        params: data
    })
}

// 解绑设备
export function unbindDevice(id) {
    return request({
        url: '/admin/yaseeuserdevice/unbinds/' + id,
        method: 'post',
    })
}

// 查询设备类型
// export function deviceTypeList(query) {
//     return request({
//       url: '/mp/yaseedevicemodel/getDeviceTypeList',
//       method: 'get',
//       params: query
//     })
//   }

// 亲友标签
  export function friendList() {
    return request({
        url: '/admin/dict/type/friend_label',
        method: 'get',
    })
}

// 设备类型
export function deviceTypeList() {
    return request({
        url: '/admin/dict/type/yasee_device_type',
        method: 'get',
    })
}


export function jsapiList(data) {
    return request({
        url: '/mp/wxsys/jsapiSignature/getByAccountId',
        method: 'get',
        params: data
    })
}

export function polocyText(amType, language, data) {
    return request({
        url: '/admin/agreement/getAgreement/' + amType + '/' + language,
        method: 'get',
        params: data
    })
}
export function isBindSn(data) {
    return request({
        url: '/admin/yaseedealerimeifree/selectBindStatusByImei',
        method: 'get',
        params: data
    })
}

// 退出登录
export function logOut(data) {
    return request({
        url: '/admin/register/logOut',
        method: 'get',
        params: data
    })
}
// 用户注销
export function logOff(data) {
    return request({
        url: '/admin/user/userRemove',
        method: 'post',
        data: data
    })
}
// ======================================================================暗促活动===============================================================================

// 暗促-获取用户信息
export function getStrStatus(data) {
    return request({
        url: '/mp/wxuser/getStrStatus',
        method: 'get',
        params: data
    })
}

// 暗促-获取重定向地址
export function getFollow(data) {
    return request({
        url: '/mp/wxuser/getPromotionAuthorize',
        method: 'post',
        data: data
    })
}

// 暗促-获取用户(店员认证)信息
export function getStrShopStatus(data) {
    return request({
        url: '/mp/wxuser/getStrShopStatus',
        method: 'get',
        params: data
    })
}

// 暗促-获取微信公众号信息
export function getWxAccount(data) {
    return request({
        url: '/mp/wxuser/getWxAccount',
        method: 'get',
        params: data
    })
}

// 暗促-提交客户信息
export function submitClerk(data) {
    return request({
        url: '/mp/mpcustomer/submit',
        method: 'post',
        data: data
    })
}

// 暗促-用户和openId关联
export function bindOpenId(data) {
    return request({
        url: '/admin/sysuserwx/bindManySocialByOpenId',
        method: 'post',
        data: data
    })
}

// 暗促-提交用户信息
export function summitShop(data) {
    return request({
        url: '/mp/mpclerk/summitShop',
        method: 'post',
        data: data
    })
}

// 暗促-获取店员登录信息重定向地址
export function clerkLogin(data) {
    return request({
        url: '/mp/wxuser/clerkLogin',
        method: 'get',
        params: data
    })
}

// 暗促-根据appId获取公众号jsapi签名
export function getByAccountId(data) {
    return request({
        url: '/mp/wxsys/jsapiSignature/getByAccountId',
        method: 'get',
        params: data
    })
}

// 暗促-店员信息认证获取验证码
export function clerkCode(mobile) {
    return request({
        url: '/admin/mobile/clerkBind/' + mobile,
        method: 'get'
    })
}

// 暗促-提交店员信息(手机号、验证码)
export function bindClerk(mobile,code) {
    return request({
        url: '/mp/mpclerk/bindClerk/' + mobile + '/' + code,
        method: 'get'
    })
}

// 暗促-获取店员信息
export function clerkInfo() {
    return request({
        url: '/mp/mpclerk/clerkInfo',
        method: 'get'
    })
}

// 暗促-获取客户扫码微信链接
export function getAuthorizeClerk(data) {
    return request({
        url: '/mp/wxuser/getAuthorizeClerk',
        method: 'post',
        data: data
    })
}

export function customerBindClerk(data) {
    return request({
        url: '/mp/wxuser/customerBindClerk',
        method: 'post',
        data: data
    })
}

export function getOpenId(data) {
    return request({
        url: '/mp/wxuser/getOpenId',
        method: 'get',
        params: data
    })
}

export function pageByOpenId(data) {
    return request({
        url: '/mp/mpcustomer/pageByOpenId',
        method: 'get',
        params: data
    })
}

// 店员信息认证
export function summitShopInvite(data) {
    return request({
        url: '/mp/mpclerk/summitShopInvite',
        method: 'post',
        data: data
    })
}

// 暗促-获取销售数据
export function getSalesData(data) {
    return request({
        url: '/mp/mpcustomer/pageSalesDetails',
        method: 'get',
        params: data
    })
}

// 暗促-生成邀请码
export function getCode(query) {
    return request({
      url: '/mp/mpclerk/invitationCode',
      method: 'post',
      data: query
    })
  }